package com.info.zhiduoduo.repository.mapper.maker;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.dto.maker.MakerAlipayPrincipalDto;
import com.info.zhiduoduo.repository.entity.maker.MakerAlipayPrincipal;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  平台的委托人账号表, 签约主体企业支付宝, 比如: 秀圣企业支付宝账户 Mapper 接口
 * </p>
 *
 * @author bob
 * @since 2021-07-06
 */
public interface MakerAlipayPrincipalMapper extends BaseMapper<MakerAlipayPrincipal> {


	@Update(" update zdd_maker_alipay_principal set frozen_amount = frozen_amount + #{amount} where id = #{principalId}")
	boolean frozen(int principalId, BigDecimal amount);

	@Select(" select id,name,available_amount from zdd_maker_alipay_principal where status = 'NORMAL' and isv = 0")
	List<MakerAlipayPrincipalDto> listValid();
}
